<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	    		xmlns:ui="http://java.sun.com/jsf/facelets"
	  			xmlns:h="http://java.sun.com/jsf/html"
	  			xmlns:f="http://java.sun.com/jsf/core"
				xmlns:c="http://java.sun.com/jstl/core"
	  			xmlns:sf="http://www.springframework.org/tags/faces"
				template="/WEB-INF/layouts/standard.xhtml">

<ui:define name="content">

<div class="totals">
	<h3>Итоги конкурса ${configProperties['cup.title']} ${configProperties['cup.dates']}</h3>
	<h:form id="stages">
		<ui:fragment id="searchResultsFragment">
			<div id="searchResults">
				<h:outputText id="noText" value="Нет итоговых данных" rendered="#{stages.rowCount == 0}"/>
				<h:dataTable id="stages" styleClass="summary" value="#{stages}" var="s" rendered="#{stages.rowCount > 0}"
					rowClasses="list-row-even,list-row-odd" 
					columnClasses="colPlace,colUser,colTotal,colCenter,colCenter,colCenter,${configProperties['cup.org'] == 'fifa'?'colCenter,':''}colCenter,colCenter,colCenter,colCenter,colCenter">
					<h:column>
						<f:facet name="header"><sf:commandLink id="sortByPlaceLink" action="sort" value="Место" processIds="*"><f:param name="sortBy" value="place" /></sf:commandLink></f:facet>
						<h:outputText value="#{s.place}" style="font-weight:#{isAdmin and s.betExist==1?'bold':'normal'};color:#{s.place== 1 ? 'darkred' : 'black'}"/>
					</h:column>
					<h:column>
						<c:if test="not empty currentUser.name">
							<f:facet name="header"><sf:commandLink id="sortByUsernameLink" action="sort" value="Участник" processIds="*"><f:param name="sortBy" value="fullname" /></sf:commandLink></f:facet>
							<h:outputText value="#{s.fullname}" style="font-weight:#{isAdmin and s.betExist==1?'bold':'normal'};color:#{s.place== 1 ? 'darkred' : 'black'}"/>
						</c:if>
						<c:if test="empty currentUser.name">
							<f:facet name="header"><sf:commandLink id="sortByUsernameLink" action="sort" value="Участник" processIds="*"><f:param name="sortBy" value="username" /></sf:commandLink></f:facet>
							<h:outputText value="#{s.username}" style="font-weight:#{isAdmin and s.betExist==1?'bold':'normal'};color:#{s.place== 1 ? 'darkred' : 'black'}"/>
						</c:if>
					</h:column>
					<h:column>
						<f:facet name="header"><sf:commandLink id="sortByTotalLink" action="sort" value="Всего очков" processIds="*"><f:param name="sortBy" value="place" /></sf:commandLink></f:facet>
						<h:outputText value="#{s.total}" style="font-weight:#{isAdmin and s.betExist==1?'bold':'normal'};color:#{s.place== 1 ? 'darkred' : 'black'}"/>
					</h:column>
					<h:column>
						<f:facet name="header"><sf:commandLink id="sortByGStage1Link" action="sort" value="I тур" processIds="*"><f:param name="sortBy" value="place1" /></sf:commandLink></f:facet>
						<a href="${request.contextPath}/action/result1" title="Кликни, чтобы посмотреть подробнее"><h:outputText value="#{s.gstage1}" style="font-weight:#{isAdmin and s.betExist==1?'bold':'normal'};color:#{s.place1 == 1 ? 'darkred' : 'black'}"/></a>
					</h:column>
					<h:column>
						<f:facet name="header"><sf:commandLink id="sortByGStage2Link" action="sort" value="II тур" processIds="*"><f:param name="sortBy" value="place2" /></sf:commandLink></f:facet>
						<a href="${request.contextPath}/action/result2" title="Кликни, чтобы посмотреть подробнее"><h:outputText value="#{s.gstage2}" style="font-weight:#{isAdmin and s.betExist==1?'bold':'normal'};color:#{s.place2 == 1 ? 'darkred' : 'black'}"/></a>
					</h:column>
					<h:column>
						<f:facet name="header"><sf:commandLink id="sortByGStage3Link" action="sort" value="III тур" processIds="*"><f:param name="sortBy" value="place3" /></sf:commandLink></f:facet>
						<a href="${request.contextPath}/action/result3" title="Кликни, чтобы посмотреть подробнее"><h:outputText value="#{s.gstage3}" style="font-weight:#{isAdmin and s.betExist==1?'bold':'normal'};color:#{s.place3 == 1 ? 'darkred' : 'black'}"/></a>
					</h:column>
					<c:if test="${configProperties['cup.org'] == 'fifa'}">
					<h:column>
						<f:facet name="header"><sf:commandLink id="sortByRoundOf16Link" action="sort" value="1/8 финала" processIds="*"><f:param name="sortBy" value="place4" /></sf:commandLink></f:facet>
						<a href="${request.contextPath}/action/result4" title="Кликни, чтобы посмотреть подробнее"><h:outputText value="#{s.roundOf16}" style="font-weight:#{isAdmin and s.betExist==1?'bold':'normal'};color:#{s.place4== 1 ? 'darkred' : 'black'}"/></a>
					</h:column>
					</c:if>
					<h:column>
						<f:facet name="header"><sf:commandLink id="sortByQuarterFinalsLink" action="sort" value="1/4 финала" processIds="*"><f:param name="sortBy" value="place4" /></sf:commandLink></f:facet>
						<a href="${request.contextPath}/action/result5" title="Кликни, чтобы посмотреть подробнее"><h:outputText value="#{s.quarterFinals}" style="font-weight:#{isAdmin and s.betExist==1?'bold':'normal'};color:#{s.place5== 1 ? 'darkred' : 'black'}"/></a>
					</h:column>
					<h:column>
						<f:facet name="header"><sf:commandLink id="sortBySemiFinalsLink" action="sort" value="1/2 финала" processIds="*"><f:param name="sortBy" value="place6" /></sf:commandLink></f:facet>
						<a href="${request.contextPath}/action/result6" title="Кликни, чтобы посмотреть подробнее"><h:outputText value="#{s.semiFinals}" style="font-weight:#{isAdmin and s.betExist==1?'bold':'normal'};color:#{s.place6== 1 ? 'darkred' : 'black'}"/></a>
					</h:column>
					<h:column>
						<f:facet name="header"><sf:commandLink id="sortByFinals1Link" action="sort" value="Финал" processIds="*"><f:param name="sortBy" value="place7" /></sf:commandLink></f:facet>
						<a href="${request.contextPath}/action/result7" title="Кликни, чтобы посмотреть подробнее"><h:outputText value="#{s.finals}" style="font-weight:#{isAdmin and s.betExist==1?'bold':'normal'};color:#{s.place7== 1 ? 'darkred' : 'black'}"/></a>
					</h:column>
					<h:column>
						<f:facet name="header"><sf:commandLink id="sortByGroupsLink" action="sort" value="За место в группе" processIds="*"><f:param name="sortBy" value="place8" /></sf:commandLink></f:facet>
						<a href="${request.contextPath}/action/groups" title="Кликни, чтобы посмотреть подробнее"><h:outputText value="#{s.groups}" style="font-weight:#{isAdmin and s.betExist==1?'bold':'normal'};color:#{s.place8== 1 ? 'darkred' : 'black'}"/></a>
					</h:column>
					<h:column>
						<f:facet name="header"><sf:commandLink id="sortByWinners1Link" action="sort" value="За место в чемпионате" processIds="*"><f:param name="sortBy" value="place9" /></sf:commandLink></f:facet>
						<a href="${request.contextPath}/action/winners" title="Кликни, чтобы посмотреть подробнее"><h:outputText value="#{s.winners}" style="font-weight:#{isAdmin and s.betExist==1?'bold':'normal'};color:#{s.place9== 1 ? 'darkred' : 'black'}"/></a>
					</h:column>
				</h:dataTable>
			</div>
		</ui:fragment>
	</h:form>
</div>

<div class="news">
	<h3>Объявления и новости</h3>
	<h:dataTable id="news" styleClass="newsdata" value="#{news}" var="n" rendered="#{news.rowCount > 0}">
		<h:column>
			<h4>#{n.title} (<h:outputText value="#{n.publishtime}">
				<f:convertDateTime pattern="dd.MM.yyyy HH:mm" timeZone="GMT+3"/>
			</h:outputText>)
			</h4>
			<h:outputText escape="false" value="#{n.news}"/> 
		</h:column>
	</h:dataTable>
</div>
</ui:define>
</ui:composition>